﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace WCS.Infrastructure.EFCore;

/// <summary>
/// 分账协议表
/// </summary>
[Table("DividedAgreement")]
[Index("AgreementCode", Name = "DividedAgreement_AgreementCode_idx", IsUnique = true)]
[Index("MerchantId", Name = "DividedAgreement_MerchantId_idx")]
public partial class DividedAgreement
{
    /// <summary>
    /// 分账协议ID
    /// </summary>
    [Key]
    [StringLength(32)]
    public string Id { get; set; } = null!;

    /// <summary>
    /// 分账协议编号
    /// </summary>
    [StringLength(32)]
    public string AgreementCode { get; set; } = null!;

    /// <summary>
    /// 分账协议名称
    /// </summary>
    [StringLength(255)]
    public string? AgreementName { get; set; }

    /// <summary>
    /// 父级协议ID
    /// </summary>
    [StringLength(32)]
    public string? ParentAgreementId { get; set; }

    /// <summary>
    /// 生效时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime StartTime { get; set; }

    /// <summary>
    /// 失效时间（为空为长期有效）
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? EndTime { get; set; }

    /// <summary>
    /// 扩展属性
    /// </summary>
    public string? ExtraProperties { get; set; }

    /// <summary>
    /// 并发标记
    /// </summary>
    [StringLength(40)]
    public string? ConcurrencyStamp { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 创建人ID
    /// </summary>
    [StringLength(32)]
    public string? CreatorId { get; set; }

    /// <summary>
    /// 最后修改时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? LastModificationTime { get; set; }

    /// <summary>
    /// 最后修改人ID
    /// </summary>
    [StringLength(32)]
    public string? LastModifierId { get; set; }

    /// <summary>
    /// 是否删除
    /// </summary>
    public bool IsDeleted { get; set; }

    /// <summary>
    /// 删除者ID
    /// </summary>
    [StringLength(32)]
    public string? DeleterId { get; set; }

    /// <summary>
    /// 删除时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? DeletionTime { get; set; }

    /// <summary>
    /// 启用状态(0=禁用，1=启用，用户设置)
    /// </summary>
    public int EnableStatus { get; set; }

    /// <summary>
    /// 激活状态(0=未激活，1=已激活，系统判断)
    /// </summary>
    public int ActivationStatus { get; set; }

    /// <summary>
    /// 分账周期
    /// </summary>
    public int? DividedCycle { get; set; }

    /// <summary>
    /// 所属商户ID
    /// </summary>
    [StringLength(32)]
    public string? MerchantId { get; set; }
}
